home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / gfx / 3d / irit50src.lha / irit5 / grapdrvs / draw_obj.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-11  |  2.5 KB  |  75 lines

  1. /*****************************************************************************
  2. *   Default object drawing routine common to graphics drivers.             *
  3. *                                         *
  4. * Written by:  Gershon Elber                Ver 0.1, June 1993.  *
  5. *****************************************************************************/
  6.  
  7. #include "irit_sm.h"
  8. #include "iritprsr.h"
  9. #include "cagd_lib.h"
  10. #include "symb_lib.h"
  11. #include "iritgrap.h"
  12. #include "attribut.h"
  13.  
  14. /*****************************************************************************
  15. * DESCRIPTION:                                                               M
  16. * Draw a single object using current modes and transformations.             M
  17. *                                                                            *
  18. * PARAMETERS:                                                                M
  19. *   PObj:      Object to draw.                                               M
  20. *                                                                            *
  21. * RETURN VALUE:                                                              M
  22. *   void                                                                     M
  23. *                                                                            *
  24. * KEYWORDS:                                                                  M
  25. *   IGDrawObject                                                             M
  26. *****************************************************************************/
  27. void IGDrawObject(IPObjectStruct *PObj)
  28. {
  29.     CagdRType *R;
  30.     PointType Pt;
  31.     int Width;
  32.  
  33.     IGSetColorObj(PObj);
  34.     if ((Width = AttrGetObjectIntAttrib(PObj, "DWidth")) != IP_ATTR_BAD_INT)
  35.     IGSetWidthObj(Width * IGGlblLineWidth);
  36.     else
  37.     IGSetWidthObj(IGGlblLineWidth);
  38.  
  39.     switch (PObj -> ObjType) {
  40.     case IP_OBJ_POLY:
  41.         IGDrawPoly(PObj);
  42.         break;
  43.     case IP_OBJ_CTLPT:
  44.         /* Coerce, in place, a control points to a regular point. */
  45.         R = PObj -> U.CtlPt.Coords;
  46.         CagdCoercePointTo(Pt, CAGD_PT_E3_TYPE,
  47.                   &R, -1, PObj -> U.CtlPt.PtType);
  48.         PT_COPY(PObj -> U.Pt, Pt);
  49.         PObj -> ObjType = IP_OBJ_POINT;
  50.     case IP_OBJ_POINT:
  51.         IGDrawPtVec(PObj);
  52.         break;
  53.     case IP_OBJ_VECTOR:
  54.         IGDrawPtVec(PObj);
  55.         break;
  56.     case IP_OBJ_CURVE:
  57.         IGDrawCurve(PObj);
  58.         break;
  59.     case IP_OBJ_SURFACE:
  60.         IGDrawSurface(PObj);
  61.         break;
  62.     case IP_OBJ_TRIMSRF:
  63.         IGDrawTrimSrf(PObj);
  64.         break;
  65.     case IP_OBJ_TRIVAR:
  66.         IGDrawTrivar(PObj);
  67.         break;
  68.     case IP_OBJ_LIST_OBJ:
  69.         IritFatalError("Should not have lists at this time");
  70.         break;
  71.     default:
  72.         break;
  73.     }
  74. }
  75.